home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / AppleEvents.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-11  |  27.4 KB  |  637 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleEvents.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __APPLEEVENTS__
  18. #define __APPLEEVENTS__
  19.  
  20.  
  21. #ifndef __ERRORS__
  22. #include <Errors.h>
  23. #endif
  24. /*    #include <ConditionalMacros.h>                                */
  25.  
  26. #ifndef __TYPES__
  27. #include <Types.h>
  28. #endif
  29.  
  30. #ifndef __MEMORY__
  31. #include <Memory.h>
  32. #endif
  33. /*    #include <MixedMode.h>                                        */
  34.  
  35. #ifndef __OSUTILS__
  36. #include <OSUtils.h>
  37. #endif
  38.  
  39. #ifndef __EVENTS__
  40. #include <Events.h>
  41. #endif
  42. /*    #include <Quickdraw.h>                                        */
  43. /*        #include <QuickdrawText.h>                                */
  44.  
  45. #ifndef __EPPC__
  46. #include <EPPC.h>
  47. #endif
  48. /*    #include <PPCToolbox.h>                                        */
  49. /*        #include <AppleTalk.h>                                    */
  50. /*    #include <Processes.h>                                        */
  51. /*        #include <Files.h>                                        */
  52.  
  53. #ifndef __NOTIFICATION__
  54. #include <Notification.h>
  55. #endif
  56.  
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif
  60.  
  61. #if GENERATINGPOWERPC
  62. #pragma options align=mac68k
  63. #endif
  64.  
  65. #ifdef __CFM68K__
  66. #pragma lib_export on
  67. #endif
  68.  
  69.  
  70. enum {
  71. /* Apple event descriptor types */
  72.     typeBoolean                    = 'bool',
  73.     typeChar                    = 'TEXT',
  74.     typeSMInt                    = 'shor',
  75.     typeInteger                    = 'long',
  76.     typeSMFloat                    = 'sing',
  77.     typeFloat                    = 'doub',
  78.     typeLongInteger                = 'long',
  79.     typeShortInteger            = 'shor',
  80.     typeLongFloat                = 'doub',
  81.     typeShortFloat                = 'sing',
  82.     typeExtended                = 'exte',
  83.     typeComp                    = 'comp',
  84.     typeMagnitude                = 'magn',
  85.     typeAEList                    = 'list',
  86.     typeAERecord                = 'reco',
  87.     typeAppleEvent                = 'aevt',
  88.     typeTrue                    = 'true',
  89.     typeFalse                    = 'fals',
  90.     typeAlias                    = 'alis',
  91.     typeEnumerated                = 'enum',
  92.     typeType                    = 'type',
  93.     typeAppParameters            = 'appa',
  94.     typeProperty                = 'prop',
  95.     typeFSS                        = 'fss ',
  96.     typeKeyword                    = 'keyw',
  97.     typeSectionH                = 'sect',
  98.     typeWildCard                = '****',
  99.     typeApplSignature            = 'sign',
  100.     typeQDRectangle                = 'qdrt',
  101.     typeFixed                    = 'fixd',
  102.     typeSessionID                = 'ssid',
  103.     typeTargetID                = 'targ',
  104.     typeProcessSerialNumber        = 'psn ',
  105.     typeNull                    = 'null',                        /* null or nonexistent data */
  106. /* Keywords for Apple event parameters */
  107.     keyDirectObject                = '----',
  108.     keyErrorNumber                = 'errn',
  109.     keyErrorString                = 'errs',
  110.     keyProcessSerialNumber        = 'psn ',
  111. /* Keywords for Apple event attributes */
  112.     keyTransactionIDAttr        = 'tran',
  113.     keyReturnIDAttr                = 'rtid',
  114.     keyEventClassAttr            = 'evcl',
  115.     keyEventIDAttr                = 'evid',
  116.     keyAddressAttr                = 'addr',
  117.     keyOptionalKeywordAttr        = 'optk',
  118.     keyTimeoutAttr                = 'timo',
  119.     keyInteractLevelAttr        = 'inte',                        /* this attribute is read only - will be set in AESend */
  120.     keyEventSourceAttr            = 'esrc',                        /* this attribute is read only */
  121.     keyMissedKeywordAttr        = 'miss',                        /* this attribute is read only */
  122.     keyOriginalAddressAttr        = 'from',                        /* new in 1.0.1 */
  123. /* Keywords for special handlers */
  124.     keyPreDispatch                = 'phac',                        /* preHandler accessor call */
  125.     keySelectProc                = 'selh',                        /* more selector call */
  126. /* Keyword for recording */
  127.     keyAERecorderCount            = 'recr',                        /* available only in vers 1.0.1 and greater */
  128. /* Keyword for version information */
  129.     keyAEVersion                = 'vers',                        /* available only in vers 1.0.1 and greater */
  130. /* Event Class */
  131.     kCoreEventClass                = 'aevt',
  132. /* Event ID’s */
  133.     kAEOpenApplication            = 'oapp',
  134.     kAEOpenDocuments            = 'odoc',
  135.     kAEPrintDocuments            = 'pdoc',
  136.     kAEQuitApplication            = 'quit',
  137.     kAEAnswer                    = 'ansr',
  138.     kAEApplicationDied            = 'obit'
  139. };
  140.  
  141. enum {
  142. /* Constants for use in AESend mode */
  143.     kAENoReply                    = 0x00000001,                    /* sender doesn't want a reply to event */
  144.     kAEQueueReply                = 0x00000002,                    /* sender wants a reply but won't wait */
  145.     kAEWaitReply                = 0x00000003,                    /* sender wants a reply and will wait */
  146.     kAENeverInteract            = 0x00000010,                    /* server should not interact with user */
  147.     kAECanInteract                = 0x00000020,                    /* server may try to interact with user */
  148.     kAEAlwaysInteract            = 0x00000030,                    /* server should always interact with user where appropriate */
  149.     kAECanSwitchLayer            = 0x00000040,                    /* interaction may switch layer */
  150.     kAEDontReconnect            = 0x00000080,                    /* don't reconnect if there is a sessClosedErr from PPCToolbox */
  151.     kAEWantReceipt                = nReturnReceipt,                /* sender wants a receipt of message */
  152.     kAEDontRecord                = 0x00001000,                    /* don't record this event - available only in vers 1.0.1 and greater */
  153.     kAEDontExecute                = 0x00002000,                    /* don't send the event for recording - available only in vers 1.0.1 and greater */
  154. /* Constants for the send priority in AESend */
  155.     kAENormalPriority            = 0x00000000,                    /* post message at the end of the event queue */
  156.     kAEHighPriority                = nAttnMsg                        /* post message at the front of the event queue */
  157. };
  158.  
  159. enum {
  160. /* Constants for recording */
  161.     kAEStartRecording            = 'reca',                        /* available only in vers 1.0.1 and greater */
  162.     kAEStopRecording            = 'recc',                        /* available only in vers 1.0.1 and greater */
  163.     kAENotifyStartRecording        = 'rec1',                        /* available only in vers 1.0.1 and greater */
  164.     kAENotifyStopRecording        = 'rec0',                        /* available only in vers 1.0.1 and greater */
  165.     kAENotifyRecording            = 'recr'
  166. };
  167.  
  168. /* Constant for the returnID param of AECreateAppleEvent */
  169. enum {
  170.     kAutoGenerateReturnID        = -1,                            /* AECreateAppleEvent will generate a session-unique ID */
  171. /* Constant for transaction ID’s */
  172.     kAnyTransactionID            = 0,                            /* no transaction is in use */
  173. /* Constants for timeout durations */
  174.     kAEDefaultTimeout            = -1,                            /* timeout value determined by AEM */
  175.     kNoTimeOut                    = -2                            /* wait until reply comes back, however long it takes */
  176. };
  177.  
  178. /* Constants for AEResumeTheCurrentEvent */
  179. enum {
  180.     kAENoDispatch                = 0,                            /* dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch */
  181.     kAEUseStandardDispatch        = 0xFFFFFFFF,                    /* table, or one of these two constants */
  182. /* Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch */
  183.     kAEDoNotIgnoreHandler        = 0x00000000,
  184.     kAEIgnoreAppPhacHandler        = 0x00000001,                    /* available only in vers 1.0.1 and greater */
  185.     kAEIgnoreAppEventHandler    = 0x00000002,                    /* available only in vers 1.0.1 and greater */
  186.     kAEIgnoreSysPhacHandler        = 0x00000004,                    /* available only in vers 1.0.1 and greater */
  187.     kAEIgnoreSysEventHandler    = 0x00000008,                    /* available only in vers 1.0.1 and greater */
  188.     kAEIngoreBuiltInEventHandler = 0x00000010,                    /* available only in vers 1.0.1 and greater */
  189.     kAEDontDisposeOnResume        = 0x80000000                    /* available only in vers 1.0.1 and greater */
  190. };
  191.  
  192. /* Apple event manager data types */
  193. typedef FourCharCode AEEventClass;
  194.  
  195. typedef FourCharCode AEEventID;
  196.  
  197. typedef FourCharCode AEKeyword;
  198.  
  199. typedef ResType DescType;
  200.  
  201. struct AEDesc {
  202.     DescType                        descriptorType;
  203.     Handle                            dataHandle;
  204. };
  205. typedef struct AEDesc AEDesc;
  206.  
  207. struct AEKeyDesc {
  208.     AEKeyword                        descKey;
  209.     AEDesc                            descContent;
  210. };
  211. typedef struct AEKeyDesc AEKeyDesc;
  212.  
  213. /* an AEDesc which contains address data */
  214. typedef AEDesc AEAddressDesc;
  215.  
  216. /* a list of AEDesc's is a special kind of AEDesc */
  217. typedef AEDesc AEDescList;
  218.  
  219. /* AERecord is a list of keyworded AEDesc's */
  220. typedef AEDescList AERecord;
  221.  
  222. /* an AERecord that contains an AppleEvent */
  223. typedef AERecord AppleEvent;
  224.  
  225. /* parameter to AESend */
  226. typedef long AESendMode;
  227.  
  228. /* priority param of AESend */
  229. typedef short AESendPriority;
  230.  
  231.  
  232. enum {
  233.     kAEInteractWithSelf            = 0,
  234.     kAEInteractWithLocal        = 1,
  235.     kAEInteractWithAll            = 2
  236. };
  237.  
  238. typedef SInt8 AEInteractAllowed;
  239.  
  240.  
  241. enum {
  242.     kAEUnknownSource            = 0,
  243.     kAEDirectCall                = 1,
  244.     kAESameProcess                = 2,
  245.     kAELocalProcess                = 3,
  246.     kAERemoteProcess            = 4
  247. };
  248.  
  249. typedef SInt8 AEEventSource;
  250.  
  251.  
  252. enum {
  253.     kAEDataArray                = 0,
  254.     kAEPackedArray                = 1,
  255.     kAEHandleArray                = 2,
  256.     kAEDescArray                = 3,
  257.     kAEKeyDescArray                = 4
  258. };
  259.  
  260. typedef SInt8 AEArrayType;
  261.  
  262. union AEArrayData {
  263.     short                            kAEDataArray[1];
  264.     char                            kAEPackedArray[1];
  265.     Handle                            kAEHandleArray[1];
  266.     AEDesc                            kAEDescArray[1];
  267.     AEKeyDesc                        kAEKeyDescArray[1];
  268. };
  269. typedef union AEArrayData AEArrayData;
  270.  
  271. typedef AEArrayData *AEArrayDataPointer;
  272.  
  273. typedef pascal Boolean (*AEIdleProcPtr)(EventRecord *theEvent, long *sleepTime, RgnHandle *mouseRgn);
  274.  
  275. #if GENERATINGCFM
  276. typedef UniversalProcPtr AEIdleUPP;
  277. #else
  278. typedef AEIdleProcPtr AEIdleUPP;
  279. #endif
  280.  
  281. enum {
  282.     uppAEIdleProcInfo = kPascalStackBased
  283.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  284.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  285.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long*)))
  286.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(RgnHandle*)))
  287. };
  288.  
  289. #if GENERATINGCFM
  290. #define NewAEIdleProc(userRoutine)        \
  291.         (AEIdleUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEIdleProcInfo, GetCurrentArchitecture())
  292. #else
  293. #define NewAEIdleProc(userRoutine)        \
  294.         ((AEIdleUPP) (userRoutine))
  295. #endif
  296.  
  297. #if GENERATINGCFM
  298. #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn)        \
  299.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEIdleProcInfo, (theEvent), (sleepTime), (mouseRgn))
  300. #else
  301. #define CallAEIdleProc(userRoutine, theEvent, sleepTime, mouseRgn)        \
  302.         (*(userRoutine))((theEvent), (sleepTime), (mouseRgn))
  303. #endif
  304.  
  305. typedef pascal Boolean (*AEFilterProcPtr)(EventRecord *theEvent, long returnID, long transactionID, const AEAddressDesc *sender);
  306.  
  307. #if GENERATINGCFM
  308. typedef UniversalProcPtr AEFilterUPP;
  309. #else
  310. typedef AEFilterProcPtr AEFilterUPP;
  311. #endif
  312.  
  313. enum {
  314.     uppAEFilterProcInfo = kPascalStackBased
  315.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  316.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EventRecord*)))
  317.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  318.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  319.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AEAddressDesc*)))
  320. };
  321.  
  322. #if GENERATINGCFM
  323. #define NewAEFilterProc(userRoutine)        \
  324.         (AEFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEFilterProcInfo, GetCurrentArchitecture())
  325. #else
  326. #define NewAEFilterProc(userRoutine)        \
  327.         ((AEFilterUPP) (userRoutine))
  328. #endif
  329.  
  330. #if GENERATINGCFM
  331. #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, sender)        \
  332.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEFilterProcInfo, (theEvent), (returnID), (transactionID), (sender))
  333. #else
  334. #define CallAEFilterProc(userRoutine, theEvent, returnID, transactionID, sender)        \
  335.         (*(userRoutine))((theEvent), (returnID), (transactionID), (sender))
  336. #endif
  337.  
  338. typedef pascal OSErr (*AEEventHandlerProcPtr)(const AppleEvent *theAppleEvent, AppleEvent *reply, long handlerRefcon);
  339.  
  340. #if GENERATINGCFM
  341. typedef UniversalProcPtr AEEventHandlerUPP;
  342. #else
  343. typedef AEEventHandlerProcPtr AEEventHandlerUPP;
  344. #endif
  345.  
  346. enum {
  347.     uppAEEventHandlerProcInfo = kPascalStackBased
  348.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  349.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AppleEvent*)))
  350.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(AppleEvent*)))
  351.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  352. };
  353.  
  354. #if GENERATINGCFM
  355. #define NewAEEventHandlerProc(userRoutine)        \
  356.         (AEEventHandlerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAEEventHandlerProcInfo, GetCurrentArchitecture())
  357. #else
  358. #define NewAEEventHandlerProc(userRoutine)        \
  359.         ((AEEventHandlerUPP) (userRoutine))
  360. #endif
  361.  
  362. #if GENERATINGCFM
  363. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon)        \
  364.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAEEventHandlerProcInfo, (theAppleEvent), (reply), (handlerRefcon))
  365. #else
  366. #define CallAEEventHandlerProc(userRoutine, theAppleEvent, reply, handlerRefcon)        \
  367.         (*(userRoutine))((theAppleEvent), (reply), (handlerRefcon))
  368. #endif
  369.  
  370. typedef pascal OSErr (*AECoerceDescProcPtr)(const AEDesc *fromDesc, DescType toType, long handlerRefcon, AEDesc *toDesc);
  371.  
  372. #if GENERATINGCFM
  373. typedef UniversalProcPtr AECoerceDescUPP;
  374. #else
  375. typedef AECoerceDescProcPtr AECoerceDescUPP;
  376. #endif
  377.  
  378. enum {
  379.     uppAECoerceDescProcInfo = kPascalStackBased
  380.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  381.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(AEDesc*)))
  382.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(DescType)))
  383.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  384.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AEDesc*)))
  385. };
  386.  
  387. #if GENERATINGCFM
  388. #define NewAECoerceDescProc(userRoutine)        \
  389.         (AECoerceDescUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoerceDescProcInfo, GetCurrentArchitecture())
  390. #else
  391. #define NewAECoerceDescProc(userRoutine)        \
  392.         ((AECoerceDescUPP) (userRoutine))
  393. #endif
  394.  
  395. #if GENERATINGCFM
  396. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc)        \
  397.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAECoerceDescProcInfo, (fromDesc), (toType), (handlerRefcon), (toDesc))
  398. #else
  399. #define CallAECoerceDescProc(userRoutine, fromDesc, toType, handlerRefcon, toDesc)        \
  400.         (*(userRoutine))((fromDesc), (toType), (handlerRefcon), (toDesc))
  401. #endif
  402.  
  403. typedef pascal OSErr (*AECoercePtrProcPtr)(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, long handlerRefcon, AEDesc *result);
  404.  
  405. #if GENERATINGCFM
  406. typedef UniversalProcPtr AECoercePtrUPP;
  407. #else
  408. typedef AECoercePtrProcPtr AECoercePtrUPP;
  409. #endif
  410.  
  411. enum {
  412.     uppAECoercePtrProcInfo = kPascalStackBased
  413.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  414.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DescType)))
  415.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(void*)))
  416.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Size)))
  417.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(DescType)))
  418.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
  419.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(AEDesc*)))
  420. };
  421.  
  422. #if GENERATINGCFM
  423. #define NewAECoercePtrProc(userRoutine)        \
  424.         (AECoercePtrUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAECoercePtrProcInfo, GetCurrentArchitecture())
  425. #else
  426. #define NewAECoercePtrProc(userRoutine)        \
  427.         ((AECoercePtrUPP) (userRoutine))
  428. #endif
  429.  
  430. #if GENERATINGCFM
  431. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result)        \
  432.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAECoercePtrProcInfo, (typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  433. #else
  434. #define CallAECoercePtrProc(userRoutine, typeCode, dataPtr, dataSize, toType, handlerRefcon, result)        \
  435.         (*(userRoutine))((typeCode), (dataPtr), (dataSize), (toType), (handlerRefcon), (result))
  436. #endif
  437.  
  438. typedef UniversalProcPtr AECoercionHandlerUPP;
  439.  
  440. /**************************************************************************
  441.  The following calls apply to any AEDesc. Every 'result' descriptor is
  442.  created for you, so you will be responsible for memory management
  443.  (including disposing) of the descriptors so created. Note: purgeable
  444.  descriptor data is not supported - the AEM does not call LoadResource.  
  445. **************************************************************************/
  446. extern pascal OSErr AECreateDesc(DescType typeCode, const void *dataPtr, Size dataSize, AEDesc *result)
  447.  THREEWORDINLINE(0x303C, 0x0825, 0xA816);
  448. extern pascal OSErr AECoercePtr(DescType typeCode, const void *dataPtr, Size dataSize, DescType toType, AEDesc *result)
  449.  THREEWORDINLINE(0x303C, 0x0A02, 0xA816);
  450. extern pascal OSErr AECoerceDesc(const AEDesc *theAEDesc, DescType toType, AEDesc *result)
  451.  THREEWORDINLINE(0x303C, 0x0603, 0xA816);
  452. extern pascal OSErr AEDisposeDesc(AEDesc *theAEDesc)
  453.  THREEWORDINLINE(0x303C, 0x0204, 0xA816);
  454. extern pascal OSErr AEDuplicateDesc(const AEDesc *theAEDesc, AEDesc *result)
  455.  THREEWORDINLINE(0x303C, 0x0405, 0xA816);
  456. /**************************************************************************
  457.   The following calls apply to AEDescList. Since AEDescList is a subtype of
  458.   AEDesc, the calls in the previous section can also be used for AEDescList.
  459.   All list and array indices are 1-based. If the data was greater than
  460.   maximumSize in the routines below, then actualSize will be greater than
  461.   maximumSize, but only maximumSize bytes will actually be retrieved.
  462. **************************************************************************/
  463. extern pascal OSErr AECreateList(const void *factoringPtr, Size factoredSize, Boolean isRecord, AEDescList *resultList)
  464.  THREEWORDINLINE(0x303C, 0x0706, 0xA816);
  465. extern pascal OSErr AECountItems(const AEDescList *theAEDescList, long *theCount)
  466.  THREEWORDINLINE(0x303C, 0x0407, 0xA816);
  467. extern pascal OSErr AEPutPtr(AEDescList *theAEDescList, long index, DescType typeCode, const void *dataPtr, Size dataSize)
  468.  THREEWORDINLINE(0x303C, 0x0A08, 0xA816);
  469. extern pascal OSErr AEPutDesc(AEDescList *theAEDescList, long index, const AEDesc *theAEDesc)
  470.  THREEWORDINLINE(0x303C, 0x0609, 0xA816);
  471. extern pascal OSErr AEGetNthPtr(const AEDescList *theAEDescList, long index, DescType desiredType, AEKeyword *theAEKeyword, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  472.  THREEWORDINLINE(0x303C, 0x100A, 0xA816);
  473. extern pascal OSErr AEGetNthDesc(const AEDescList *theAEDescList, long index, DescType desiredType, AEKeyword *theAEKeyword, AEDesc *result)
  474.  THREEWORDINLINE(0x303C, 0x0A0B, 0xA816);
  475. extern pascal OSErr AESizeOfNthItem(const AEDescList *theAEDescList, long index, DescType *typeCode, Size *dataSize)
  476.  THREEWORDINLINE(0x303C, 0x082A, 0xA816);
  477. extern pascal OSErr AEGetArray(const AEDescList *theAEDescList, AEArrayType arrayType, AEArrayDataPointer arrayPtr, Size maximumSize, DescType *itemType, Size *itemSize, long *itemCount)
  478.  THREEWORDINLINE(0x303C, 0x0D0C, 0xA816);
  479. extern pascal OSErr AEPutArray(AEDescList *theAEDescList, AEArrayType arrayType, const AEArrayData *arrayPtr, DescType itemType, Size itemSize, long itemCount)
  480.  THREEWORDINLINE(0x303C, 0x0B0D, 0xA816);
  481. extern pascal OSErr AEDeleteItem(AEDescList *theAEDescList, long index)
  482.  THREEWORDINLINE(0x303C, 0x040E, 0xA816);
  483. /**************************************************************************
  484.  The following calls apply to AERecord. Since AERecord is a subtype of
  485.  AEDescList, the calls in the previous sections can also be used for
  486.  AERecord an AERecord can be created by using AECreateList with isRecord
  487.  set to true. 
  488. **************************************************************************/
  489. #define AEPutKeyPtr(theAERecord, theAEKeyword, typeCode, dataPtr, dataSize)  \
  490.     AEPutParamPtr((theAERecord), (theAEKeyword), (typeCode), (dataPtr), (dataSize))
  491. #define AEPutKeyDesc(theAERecord, theAEKeyword, theAEDesc)  \
  492.     AEPutParamDesc((theAERecord), (theAEKeyword), (theAEDesc))
  493. #define AEGetKeyPtr(theAERecord, theAEKeyword, desiredType, typeCode, dataPtr, maxSize, actualSize)  \
  494.     AEGetParamPtr((theAERecord), (theAEKeyword), (desiredType), (typeCode), (dataPtr), (maxSize), (actualSize))
  495. #define AEGetKeyDesc(theAERecord, theAEKeyword, desiredType, result)  \
  496.     AEGetParamDesc((theAERecord), (theAEKeyword), (desiredType), (result))
  497. #define AESizeOfKeyDesc(theAERecord, theAEKeyword, typeCode, dataSize)  \
  498.     AESizeOfParam((theAERecord), (theAEKeyword), (typeCode), (dataSize))
  499. #define AEDeleteKeyDesc(theAERecord, theAEKeyword)  \
  500.     AEDeleteParam((theAERecord), (theAEKeyword))
  501. extern pascal OSErr AEPutParamPtr(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType typeCode, const void *dataPtr, Size dataSize)
  502.  THREEWORDINLINE(0x303C, 0x0A0F, 0xA816);
  503. extern pascal OSErr AEPutParamDesc(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, const AEDesc *theAEDesc)
  504.  THREEWORDINLINE(0x303C, 0x0610, 0xA816);
  505. extern pascal OSErr AEGetParamPtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  506.  THREEWORDINLINE(0x303C, 0x0E11, 0xA816);
  507. extern pascal OSErr AEGetParamDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, AEDesc *result)
  508.  THREEWORDINLINE(0x303C, 0x0812, 0xA816);
  509. extern pascal OSErr AESizeOfParam(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType *typeCode, Size *dataSize)
  510.  THREEWORDINLINE(0x303C, 0x0829, 0xA816);
  511. extern pascal OSErr AEDeleteParam(AppleEvent *theAppleEvent, AEKeyword theAEKeyword)
  512.  THREEWORDINLINE(0x303C, 0x0413, 0xA816);
  513. /**************************************************************************
  514.  The following calls also apply to type AppleEvent. Message attributes are
  515.  far more restricted, and can only be accessed through the following 5
  516.  calls. The various list and record routines cannot be used to access the
  517.  attributes of an event. 
  518. **************************************************************************/
  519. extern pascal OSErr AEGetAttributePtr(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, DescType *typeCode, void *dataPtr, Size maximumSize, Size *actualSize)
  520.  THREEWORDINLINE(0x303C, 0x0E15, 0xA816);
  521. extern pascal OSErr AEGetAttributeDesc(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType desiredType, AEDesc *result)
  522.  THREEWORDINLINE(0x303C, 0x0826, 0xA816);
  523. extern pascal OSErr AESizeOfAttribute(const AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType *typeCode, Size *dataSize)
  524.  THREEWORDINLINE(0x303C, 0x0828, 0xA816);
  525. extern pascal OSErr AEPutAttributePtr(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, DescType typeCode, const void *dataPtr, Size dataSize)
  526.  THREEWORDINLINE(0x303C, 0x0A16, 0xA816);
  527. extern pascal OSErr AEPutAttributeDesc(AppleEvent *theAppleEvent, AEKeyword theAEKeyword, const AEDesc *theAEDesc)
  528.  THREEWORDINLINE(0x303C, 0x0627, 0xA816);
  529. /**************************************************************************
  530.   The next couple of calls are basic routines used to create, send,
  531.   and process AppleEvents. 
  532. **************************************************************************/
  533. extern pascal OSErr AECreateAppleEvent(AEEventClass theAEEventClass, AEEventID theAEEventID, const AEAddressDesc *target, short returnID, long transactionID, AppleEvent *result)
  534.  THREEWORDINLINE(0x303C, 0x0B14, 0xA816);
  535. extern pascal OSErr AESend(const AppleEvent *theAppleEvent, AppleEvent *reply, AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks, AEIdleUPP idleProc, AEFilterUPP filterProc)
  536.  THREEWORDINLINE(0x303C, 0x0D17, 0xA816);
  537. extern pascal OSErr AEProcessAppleEvent(const EventRecord *theEventRecord)
  538.  THREEWORDINLINE(0x303C, 0x021B, 0xA816);
  539. /* 
  540.  Note: during event processing, an event handler may realize that it is likely
  541.  to exceed the client's timeout limit. Passing the reply to this
  542.  routine causes a wait event to be generated that asks the client
  543.  for more time. 
  544. */
  545. extern pascal OSErr AEResetTimer(const AppleEvent *reply)
  546.  THREEWORDINLINE(0x303C, 0x0219, 0xA816);
  547. /**************************************************************************
  548.  The following four calls are available for applications which need more
  549.  sophisticated control over when and how events are processed. Applications
  550.  which implement multi-session servers or which implement their own
  551.  internal event queueing will probably be the major clients of these
  552.  routines. They can be called from within a handler to prevent the AEM from
  553.  disposing of the AppleEvent when the handler returns. They can be used to
  554.  asynchronously process the event (as MacApp does).
  555. **************************************************************************/
  556. extern pascal OSErr AESuspendTheCurrentEvent(const AppleEvent *theAppleEvent)
  557.  THREEWORDINLINE(0x303C, 0x022B, 0xA816);
  558. /* 
  559.  Note: The following routine tells the AppleEvent manager that processing
  560.  is either about to resume or has been completed on a previously suspended
  561.  event. The procPtr passed in as the dispatcher parameter will be called to
  562.  attempt to redispatch the event. Several constants for the dispatcher
  563.  parameter allow special behavior. They are:
  564.       - kAEUseStandardDispatch means redispatch as if the event was just
  565.       received, using the standard AppleEvent dispatch mechanism.
  566.       - kAENoDispatch means ignore the parameter.
  567.          Use this in the case where the event has been handled and no
  568.       redispatch is needed.
  569.       - non nil means call the routine which the dispatcher points to.
  570. */
  571. extern pascal OSErr AEResumeTheCurrentEvent(const AppleEvent *theAppleEvent, const AppleEvent *reply, AEEventHandlerUPP dispatcher, long handlerRefcon)
  572.  THREEWORDINLINE(0x303C, 0x0818, 0xA816);
  573. extern pascal OSErr AEGetTheCurrentEvent(AppleEvent *theAppleEvent)
  574.  THREEWORDINLINE(0x303C, 0x021A, 0xA816);
  575. extern pascal OSErr AESetTheCurrentEvent(const AppleEvent *theAppleEvent)
  576.  THREEWORDINLINE(0x303C, 0x022C, 0xA816);
  577. /**************************************************************************
  578.   The following three calls are used to allow applications to behave
  579.   courteously when a user interaction such as a dialog box is needed. 
  580. **************************************************************************/
  581. extern pascal OSErr AEGetInteractionAllowed(AEInteractAllowed *level)
  582.  THREEWORDINLINE(0x303C, 0x021D, 0xA816);
  583. extern pascal OSErr AESetInteractionAllowed(AEInteractAllowed level)
  584.  THREEWORDINLINE(0x303C, 0x011E, 0xA816);
  585. extern pascal OSErr AEInteractWithUser(long timeOutInTicks, NMRecPtr nmReqPtr, AEIdleUPP idleProc)
  586.  THREEWORDINLINE(0x303C, 0x061C, 0xA816);
  587. /**************************************************************************
  588.   These calls are used to set up and modify the event dispatch table.
  589. **************************************************************************/
  590. extern pascal OSErr AEInstallEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, long handlerRefcon, Boolean isSysHandler)
  591.  THREEWORDINLINE(0x303C, 0x091F, 0xA816);
  592. extern pascal OSErr AERemoveEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP handler, Boolean isSysHandler)
  593.  THREEWORDINLINE(0x303C, 0x0720, 0xA816);
  594. extern pascal OSErr AEGetEventHandler(AEEventClass theAEEventClass, AEEventID theAEEventID, AEEventHandlerUPP *handler, long *handlerRefcon, Boolean isSysHandler)
  595.  THREEWORDINLINE(0x303C, 0x0921, 0xA816);
  596. /**************************************************************************
  597.   These calls are used to set up and modify the coercion dispatch table.
  598. **************************************************************************/
  599. extern pascal OSErr AEInstallCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP handler, long handlerRefcon, Boolean fromTypeIsDesc, Boolean isSysHandler)
  600.  THREEWORDINLINE(0x303C, 0x0A22, 0xA816);
  601. extern pascal OSErr AERemoveCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP handler, Boolean isSysHandler)
  602.  THREEWORDINLINE(0x303C, 0x0723, 0xA816);
  603. extern pascal OSErr AEGetCoercionHandler(DescType fromType, DescType toType, AECoercionHandlerUPP *handler, long *handlerRefcon, Boolean *fromTypeIsDesc, Boolean isSysHandler)
  604.  THREEWORDINLINE(0x303C, 0x0B24, 0xA816);
  605. /**************************************************************************
  606.   These calls are used to set up and modify special hooks into the
  607.   AppleEvent manager.
  608. **************************************************************************/
  609. extern pascal OSErr AEInstallSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  610.  THREEWORDINLINE(0x303C, 0x0500, 0xA816);
  611. extern pascal OSErr AERemoveSpecialHandler(AEKeyword functionClass, UniversalProcPtr handler, Boolean isSysHandler)
  612.  THREEWORDINLINE(0x303C, 0x0501, 0xA816);
  613. extern pascal OSErr AEGetSpecialHandler(AEKeyword functionClass, UniversalProcPtr *handler, Boolean isSysHandler)
  614.  THREEWORDINLINE(0x303C, 0x052D, 0xA816);
  615. /**************************************************************************
  616.   This call was added in version 1.0.1. If called with the keyword
  617.   keyAERecorderCount ('recr'), the number of recorders that are
  618.   currently active is returned in 'result'.
  619. **************************************************************************/
  620. /* available only in vers 1.0.1 and greater */
  621. extern pascal OSErr AEManagerInfo(AEKeyword keyWord, long *result)
  622.  THREEWORDINLINE(0x303C, 0x0441, 0xA816);
  623.  
  624. #ifdef __CFM68K__
  625. #pragma lib_export off
  626. #endif
  627.  
  628. #if GENERATINGPOWERPC
  629. #pragma options align=reset
  630. #endif
  631.  
  632. #ifdef __cplusplus
  633. }
  634. #endif
  635.  
  636. #endif /* __APPLEEVENTS__ */
  637.